<?php

namespace App\Repository\Wuliu;

use App\Entity\User;
use App\Entity\Wuliu\WuliuUser;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;

/**
 * @method WuliuUser|null find($id, $lockMode = null, $lockVersion = null)
 * @method WuliuUser|null findOneBy(array $criteria, array $orderBy = null)
 * @method WuliuUser[]    findAll()
 * @method WuliuUser[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
 */
class WuliuUserRepository extends ServiceEntityRepository
{
    public function __construct(ManagerRegistry $registry)
    {
        parent::__construct($registry, WuliuUser::class);
    }

    /**
     * @param User $user
     * @return WuliuUser|null
     */
    public function getByUser(User $user)
    {
        return $this->findOneBy(array("user"=>$user));
    }
    // /**
    //  * @return WuliuUser[] Returns an array of WuliuUser objects
    //  */
    /*
    public function findByExampleField($value)
    {
        return $this->createQueryBuilder('w')
            ->andWhere('w.exampleField = :val')
            ->setParameter('val', $value)
            ->orderBy('w.id', 'ASC')
            ->setMaxResults(10)
            ->getQuery()
            ->getResult()
        ;
    }
    */

    /*
    public function findOneBySomeField($value): ?WuliuUser
    {
        return $this->createQueryBuilder('w')
            ->andWhere('w.exampleField = :val')
            ->setParameter('val', $value)
            ->getQuery()
            ->getOneOrNullResult()
        ;
    }
    */
}
